<?php
/*
 * @Author: your name
 * @Date: 2020-10-22 11:05:30
 * @LastEditTime: 2020-10-23 14:25:54
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /special/application/api/service/client_login/HgshieldLoginService.php
 */
namespace app\api\service\client_login;

use app\common\exception\CustomException;
use app\common\service\IpsConfig;

class HgshieldLoginService extends LoginService
{
    public $module = 'hgshield';
    /**
     * @name: 函谷盾 登陆接口
     * @Param:
     * @Description:
     * @Author: foo
     * @Date: 2019-12-07 15:11:05
     */
    function login ()
    {
        $IpsConfig = new IpsConfig();
        $configData = $IpsConfig->findData(['host_id'=> $this->host_id]);
        if(empty($configData))
        {
           throw new CustomException('没找到函谷盾设置!!', 422);
        }
        $return = [
            'WipfMode' => $configData['type'] == 1 ? 'ips' : 'ids',//函谷盾模式
            'IpsProcessStatus' => $configData['status'] ? true : false,
            'IdsDevice' => $configData['device_ip'],
            'IpsDevice' => $configData['protect_ip'],
            'IpsBlackList' => $configData['black'] ? true : false,
            'Lock' => $configData['firewall'] ? true : false,
        ];

        return $return;
    }
}